﻿import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQml.Models 2.12

Item {
    id: box
    Rectangle {
        x: 295
        y: 215
        id:bluesquare
        // making this item draggable, so don't use anchors
        border.color: "blue"
        border.width:1
        width: 50
        height: 50

        anchors.left: rect1.right
        anchors.leftMargin: 50
        Text {
            anchors.centerIn: parent
            text: "drag"
            color: "orange"
        }
        MouseArea {
            anchors.fill: parent
            drag.target: bluesquare
            drag.axis: Drag.XAndYAxis
            drag.minimumX: 0
            drag.maximumX: box.width - parent.width
            drag.minimumY: 0
            drag.maximumY: box.height - parent.width
        }
    }

    Rectangle {
        id: rect1
        x: 181
        y: 215
        color: "red"
        width: 50
        height: 50
    }
}





/*##^## Designer {
    D{i:0;autoSize:true;height:480;width:640}D{i:1;anchors_height:120;anchors_width:120;anchors_x:0;anchors_y:10}
}
 ##^##*/
